package com.ngc.mall.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ngc.mall.common.configure.mybatisPlus.BaseDomain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@TableName("role")
@AllArgsConstructor
@NoArgsConstructor
public class AdminRoleDomain extends BaseDomain {


    private String name;

    private String note;

    private Boolean isEnabled;

    @TableLogic
    private Boolean deleted;

    @TableField(exist =false)
    List<Long> permissions;


    public void setPermissions(List<Long> permissions) {
        if(permissions.isEmpty()){
            return;
        }
        this.permissions= permissions;
    }
}
